package com.ruoyi.bussiness.controller;

import com.ruoyi.common.core.api.ApiResult;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.mp.AliOSSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Song
 * @date 2024/9/3 15:51
 * @description
 */
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/business")
@Api(tags = "上传文件Controller")
public class UploadController {
    private final AliOSSUtils aliOSSUtils;



    @PostMapping("/upload")
    @ApiOperation("上传图片接口")
    public ApiResult<String> upload(@Param("file") MultipartFile file){
        String url = aliOSSUtils.uploadImgFile(file);
        return ApiResult.ok(url);
    }
}
